package com.onepiece.shipelves.common.ticker;

import com.onepiece.shipelves.common.utils.JsonUtil;

/**
 * @author guoyanjiang
 * @date 2019-04-09
 */
public class ExchangeFuturePairDTO extends ExchangePairDTO {

    private String exchangeFutureKey;
    private String future;

    public ExchangeFuturePairDTO() {
    }

    public ExchangeFuturePairDTO(String exchangeKey, BaseTickerPair baseTickerPair, String coinKey, String symbolShow, String currencyShow, String future, String exchangeFutureKey) {
        super(exchangeKey, baseTickerPair, coinKey, symbolShow, currencyShow, 2);
        this.future = future;
        this.exchangeFutureKey = exchangeFutureKey;
        super.exchangeCurrency = new ExchangeCurrency(exchangeFutureKey, provideCoinCurrencyUnitInPair());
    }

    public String getExchangeFutureKey() {
        return exchangeFutureKey;
    }

    public void setExchangeFutureKey(String exchangeFutureKey) {
        this.exchangeFutureKey = exchangeFutureKey;
    }

    public String getFuture() {
        return future;
    }

    public void setFuture(String future) {
        this.future = future;
    }

    @Override
    public String provideTickerPair() {
        return String.format("%s_%s", super.provideTickerPair(), future);
    }

    @Override
    public String provideTickerExchangeKey() {
        return exchangeFutureKey;
    }

    @Override
    public String provideTickerCurrency() {
        return String.format("%s_%s", super.provideCoinCurrencyUnitInPair(), future);
    }

    @Override
    public String providePairShow() {
        return symbolShow + "_" + super.getCurrencyShow() + "_" + future;
    }

    @Override
    public String toString() {
        return JsonUtil.toJson(this);
    }

}
